﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GroupManager.Class;
using GroupManager.Resource.CSDL;
using System.Data;
using System.Data.OleDb;
using System.IO;

namespace GroupManager
{
    public partial class AN_Test : System.Web.UI.Page
    {
        DataTable dt = new DataTable();
        protected void Page_Load(object sender, EventArgs e)
        {
            dt.Columns.Add("Mã sinh viên");
            dt.Columns.Add("Họ tên");
            DataRow dr = dt.NewRow();
            dr[0] = "botay";
            dr[1] = "botay";
            dt.Rows.Add(dr);
            DataRow dr2 = dt.NewRow();
            dr2[0] = "hello";
            dr2[1] = "hello";
            dt.Rows.Add(dr2);
            string a = "Abc";
            string b = "abc";
            if (string.Compare(a, b, true) == 0)
            {
                Response.Write("abc");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            TextBox1.Text = "Abc";
        }
        [System.Web.Script.Services.ScriptMethod()]
        [System.Web.Services.WebMethod]
        public static List<string> SearchMember(string prefixText, int count)
        {
            List<string> members = new List<string>();
            string[] mang = { "abc", "abc1", "abc2", "1111", "11", "11111", "2222" };
            foreach (var item in mang)
            {
                if (item.Contains(prefixText))
                {
                    members.Add(item);
                }
            }

            return members;
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            
            DataTable dataTable = null;
            try
            {
                dataTable = LopDanhSach.ImportDanhSachTuFileExcel(FileUpload1);
            }
            
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            GridView1.DataSource = dataTable;
            GridView1.DataBind();
            //LopDanhSach.LuuVaoCSDL(GridView1);
        }



        protected void Button4_Click(object sender, EventArgs e)
        {       
            LopDanhSach.ExportExcel(dt);
        }
    }
}